{literal}
<script type="text/javascript">
<!--
function confirmDelete(articleId) 
{
    if (confirm("This will delete the article. Continue?")){/literal}
    document.location = "{$pagename}&action=delete&id=" + articleId;{literal}
}

function confirmPublish(articleId)
{
    if (confirm("This will publish the article. Continue?")){/literal}
    document.location = "{$pagename}&action=publish&id=" + articleId;{literal}
}

function confirmunPublish(articleId)
{
    if (confirm("This will unpublish the article. Continue?")){/literal}
    document.location = "{$pagename}&action=unpublish&id=" + articleId;{literal}
}
//-->
</script>
{/literal}
{if $action != "edit"}
{if $numarticles > 0}
<h2>Articles</h2>
	<table width="100%" border="0" cellpadding="4" cellspacing="1" class="table">
<tr> 
  <th width="10%" class="smallhead">Action</th>
  <th width="10%" class="smallhead">Published</th>
  <th width="15%" class="smallhead">Title</th>
  <th width="15%" class="smallhead">Author</th>
  <th width="30%" class="smallhead">Summary</th>
  <th width="10%" class="smallhead">Date of Post</th>
  <th width="10%" class="smallhead">Patrol</th>
  </tr>

{section name=articles loop=$numarticles}
<tr>
  <td class="text"><a href="{$pagename}&amp;id={$row[articles].ID}&amp;action=edit"><img src="{$tempdir}admin/images/edit.gif" border="0" alt="Edit {$row[articles].title}" title="Edit {$row[articles].title}" /></a> - <a href="javascript:confirmDelete({$row[articles].ID})"><img src="{$tempdir}admin/images/delete.gif" border="0" alt="Delete {$row[articles].title}" title="Delete {$row[articles].title}" /></a></td>
  <td class="text">{if $row[articles].allowed == 0}<a href="javascript:confirmPublish({$row[articles].ID})"><img src="{$tempdir}admin/images/publish.png" border="0" alt="Publish {$row[articles].title}" title="Publish {$row[articles].title}" /></a>{else}<a href="javascript:confirmunPublish({$row[articles].ID})"><img src="{$tempdir}admin/images/unpublish.png" border="0" alt="Unpublish {$row[articles].title}" title="Unpublish {$row[articles].title}" /></a>{/if}</td>
  <td class="text">{$row[articles].title}</td>
  <td class="text">{$row[articles].author}</td>
  <td class="text">{$row[articles].detail|strip_tags|truncate:100}</td>
  <td class="text">{$row[articles].date_post+$timeoffset|date_format:"%B %e, %Y %H:%M"}</td>
  <td class="text">{$row[articles].patrol}</td>
</tr>
{/section}
</table>
{else}
<div align="center">No articles</div>
{/if}
{else}
<form action="{$editFormAction}" method="post" name="noteadd" id="noteadd" enctype="multipart/form-data" onSubmit="return submitForm()">
				  <table width="100%"  border="0" cellspacing="0" cellpadding="2" class="content">
				   <tr><th class="bighead" colspan="2">Edit Article</th></tr>
                    <tr>
                      <td align="right">Title:</td>
                      <td align="left"><input name="title" type="text" id="title" size="50" value="{$row.title}" class="inputbox" /></td>
                    </tr>
                    <tr>
                      <td align="right">Date of event (If not an event leave blank):</td>
                      <td align="left"><input name="dh" type="text" id="dh" size="16" value="{$row.date_happen}" class="inputbox" /></td>
                    </tr>
					<tr>
                      <td align="right">Author:</td>
                      <td align="left"><input name="auth" type="text" id="auth" size="50" value="{$row.author}" class="inputbox" /></td>
                    </tr>	
					<tr>
					 <td align="right">Album to use:</td>
					 <td align="left">
						<select name="cat" class="inputbox">
						  <option value="">None</option>
						  {section name=albums loop=$numalbum}
						  	<option value="{$id[albums]}" {if $row.album_id == $id[albums]} selected{/if}>{$albumname[albums]}</option>
						  {/section}
						</select>
					</td>
				  </tr>
                  </table>
				   <h2 align="center">Article:</h2>
                        <textarea id="editor" name="editor" style="width:100%; height:50em" class="inputbox">{$row.detail}</textarea>	
				{if $level < 3}<div align="center">
				For Patrol:
					<select name="patrol" class="inputbox">
						{section name=team loop=$numteams}
							<option value="{$teamname[team]}" {if $articleteam == $teamname[team]} selected{/if} >{$teamname[team]}</option>
						{/section}
                        <option value="general" {if $articleteam == 'general'} selected{/if} >General Articles</option>
					</select>
				</div>{/if}
				  <p align="center">
					<input type="submit" name="Submit" value="Update" class="button" />
      <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="window.location = '{$pagename}';" class="button" />
				  </p>
</form>
{/if}
<div align="center">
 <a href="http://www.cmscout.za.net/index.php?page=subsite&amp;site=Manual&amp;content=adminpanel-articles" target="_blank">Help</a>
</div>
